<?php

require_once('PHPUnit/Framework.php');
require_once('../IntranetAddress.inc');

class IntranetAddressTest extends PHPUnit_Framework_TestCase {

    protected $fixture;

    public function setUp() {
        $this->fixture = new IntranetAddress('../network.inc');
    }

    public function testIsIntranet() {
        $this->assertTrue( $this->fixture->is_intranet('127.1.2.3') );
        $this->assertTrue( $this->fixture->is_intranet('10.1.2.3') );
        $this->assertFalse( $this->fixture->is_intranet('10.4.1.2') );
        $this->assertTrue( $this->fixture->is_intranet('172.16.1.2') );
        $this->assertFalse( $this->fixture->is_intranet('172.32.1.2') );
        $this->assertTrue( $this->fixture->is_intranet('192.168.1.2') );
        $this->assertTrue( $this->fixture->is_intranet('localhost.localdomain') );
        $this->assertFalse( $this->fixture->is_intranet('www.example.com') );
    }
 
}
?>
